import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import axios from 'axios'

import './assets/css/reset.css'
axios.defaults.baseURL = ' http://www.tangxiaoyang.vip:8888/api/v2/' //配置请求数据基础路径

//全局组成第三方表格组件
import TreeTable from 'vue-table-with-tree-grid'
Vue.component('tree-table', TreeTable)

//引入第三方库富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
 
Vue.use(VueQuillEditor)

//中央数据总线
// const bus = new new Vue()
// export default bus

//axios拦截器 ，为请求头添加token认证
axios.interceptors.request.use(config => {   
  const userInfo = JSON.parse( sessionStorage.getItem('userInfo'))
  config.headers.Authorization = userInfo? userInfo.data.token : '';
  return config;
})


Vue.prototype.$http = axios;
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
